<?php
class Place_Model_SaleUserRoleFeature extends Zend_Db_Table{
    protected $_name  = "sale_role_feature";
    protected $_primary = "sale_role_feature_id";
    
    public function getFeatureOfUserRole($userRole){
        $normalUtils = new My_Utils_NormalUtils();
        $DB = $normalUtils->getNormalDb(1);
        $getRoleFeatureId = $DB ->select()
                                ->from(
                                    array('rf' => 'sale_role_feature'),
                                    array('sale_feature_id')
                                    )
                                ->where('sale_role_id = ?',$userRole);
        $getRoleFeature = $DB   ->select()
                                ->from(
                                    array('sf' => 'sale_feature'),
                                    array('sale_feature_id', 'feature_name', 'feature_url')
                                    )
                                ->where('sale_feature_id IN ?', $getRoleFeatureId)
                                ->where('sale_feature_id > 10')
                                ->order('feature_order');
        
        $queryResult = $DB->fetchAll($getRoleFeature);
        return $queryResult;
    }
}
